package fem2.observer;

import fem2.Debugger;
import fem2.Observer;

public class TimingObserver implements Observer {

	private long start, end;
	private long start1, end1;

	public TimingObserver() {

	}

	@Override
	public void fireStarted() {
		start = System.currentTimeMillis();
	}

	@Override
	public void fireTimeStepStarted() {
		start1 = System.currentTimeMillis();
	}

	@Override
	public void fireIterationStarted() {

	}

	@Override
	public void fireIterationFinished() {
	}

	@Override
	public void fireTimeStepFinished() {
		end1 = System.currentTimeMillis();
		Debugger.watch("Stepping time: " + (end1 - start1) + " ms");
	}

	@Override
	public void fireFinished() {
		end = System.currentTimeMillis();
		Debugger.watch("Total time: " + (end - start) + " ms");
	}
}
